package cn.darkhorse.alarm.service;

import cn.darkhorse.alarm.dto.AlarmRecordInfoDTO;
import cn.darkhorse.alarm.pojo.AlarmRecordInfo;
import cn.darkhorse.alarm.vo.AlarmRecordInfoVO;
import cn.darkhorse.meswechat.dto.WxSendMessageMoreDTO;
import com.baomidou.mybatisplus.extension.service.IService;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 报警记录表 服务类
 * </p>
 *
 * @author maoguanjun
 * @since 2023-04-07
 */
public interface AlarmRecordInfoService extends IService<AlarmRecordInfo> {

    /**
     * 列表
     * @param alarmRecordInfoDTO
     * @return
     */
    List<AlarmRecordInfoVO> listAll(AlarmRecordInfoDTO alarmRecordInfoDTO);

    /**
     * 是否存在记录
     * @return
     */
    List<AlarmRecordInfo> getLastRecord();

    /**
     * 单条记录处理
     * @param recordId
     * @param handleDescription
     * @return
     */
    boolean handleSingle(Long recordId, String handleDescription);

    /**
     * 根据设备id批量处理
     * @param deviceId
     * @param handleDescription
     * @return
     */
    boolean handleByDeviceId(Long deviceId, String handleDescription);

    /**
     * 根据参数Id批量处理
     * @param paramterId
     * @param handleDescription
     * @return
     */
    boolean handleByParameterId(Long paramterId, String handleDescription);
    /**
     * 根据设备id批量处理
     * @param deviceId
     * @param handleDescription
     * @return
     */
    boolean handleByDeviceId(Long deviceId, String handleDescription, String alarmPic);

    /**
     * 根据参数Id批量处理
     * @param paramterId
     * @param handleDescription
     * @return
     */
    boolean handleByParameterId(Long paramterId, String handleDescription, String alarmPic);

    /**
     * 倒序取最新5条
     * @return
     */
    List<AlarmRecordInfoVO> listLastFive();

    /**
     * 是否存在预警记录
     * @param deviceId
     * @param paramterId
     * @return
     */
    boolean hasAlarm(Long deviceId, Long paramterId);

    AlarmRecordInfoVO view(Long recordId);

    List<WxSendMessageMoreDTO> getSendMsg();

    /**
     * 处理单条记录 带图片
     * @param recordId
     * @param handleDescription
     * @param alarmPic
     * @return
     */
    boolean handleSingle(Long recordId, String handleDescription, String alarmPic);


    /**
     * 批量清除未处理的告警信息
     */
    boolean clearAll(String handleDescription);

    /**
     * 设备实时报警状态
     * @param deviceId
     * @return
     */
    boolean checkAlarmStatus(Long deviceId);

    boolean checkAlarmStatus(List<Long> deviceIds);

    Map<Long, List<AlarmRecordInfo>> getAllAlarmRecords();
}
